<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function insert(arr, item, index) {
      let _arr = []
      for (i = 0; i < arr.length; i++) {
        if (i === index) {
          _arr[i] = item
          _arr.push(arr[i])
        } else {
          _arr.push(arr[i])
        }
      }
      return _arr
    }

    console.log(insert([2, 3, 4, 5, 6], 'd', 0));

  </script>
</body>

</html>